<!--
Copyright (C) 2023 Nicola Murino

This WebUI uses the KeenThemes Mega Bundle, a proprietary theme:

https://keenthemes.com/products/templates-mega-bundle

KeenThemes HTML/CSS/JS components are allowed for use only within the
SFTPGo product and restricted to be used in a resealable HTML template
that can compete with KeenThemes products anyhow.

This WebUI is allowed for use only within the SFTPGo product and
therefore cannot be used in derivative works/products without an
explicit grant from the SFTPGo Team (support@sftpgo.com).
-->
{{- define "navitems"}}
{{- block "additionalnavitems" .}}{{- end}}
{{- if ne .CurrentURL .EditURL }}
{{- template "theme-switcher"}}
{{- end}}
<div class="d-flex align-items-center ms-2 ms-lg-3">
    <div class="btn btn-icon btn-active-light-primary w-35px h-35px w-md-40px h-md-40px" data-kt-menu-trigger="{default:'click', lg: 'hover'}" data-kt-menu-attach="parent" data-kt-menu-placement="bottom-end">
        <i class="ki-duotone ki-user fs-2">
            <i class="path1"></i>
            <i class="path2"></i>
        </i>
    </div>
    <div class="menu menu-sub menu-sub-dropdown menu-column menu-rounded menu-title-gray-700 menu-icon-gray-500 menu-active-bg menu-state-color fw-semibold py-4 w-250px" data-kt-menu="true">
        {{- if not .IsLoggedToShare }}
        <div class="menu-item px-3 my-0">
            <div class="menu-content d-flex align-items-center px-3 py-2">
                <div class="me-5">
                    <i class="ki-duotone ki-user fs-2">
                        <i class="path1"></i>
                        <i class="path2"></i>
                    </i>
                </div>
                <div class="d-flex flex-column">
                    <div class="fw-semibold d-flex align-items-center fs-5">
                        <span class="w-175px wrap-word">{{.LoggedUser.Username}}</span>
                    </div>
                </div>
            </div>
        </div>
        <div class="separator my-2"></div>
        <div class="menu-item px-3 my-0">
            <a href="{{.ProfileURL}}" class="menu-link px-3 py-2">
                <span data-i18n="title.profile" class="menu-title">Profile</span>
            </a>
        </div>
        {{- if .LoggedUser.CanChangePassword}}
        <div class="menu-item px-3 my-0">
            <a href="{{.ChangePwdURL}}" class="menu-link px-3 py-2">
                <span data-i18n="title.change_password" class="menu-title">Change password</span>
            </a>
        </div>
        {{- end}}
        {{- end}}
        <div class="menu-item px-3 my-0">
            <a id="id_logout_link" href="#" class="menu-link px-3 py-2">
                <span data-i18n="login.signout" class="menu-title">Sign out</span>
            </a>
        </div>
    </div>
</div>
{{- end}}

{{- define "sidebaritems"}}
<div class="menu-item">
    <a class="menu-link {{- if eq .CurrentURL .FilesURL}} active{{- end}}" href="{{.FilesURL}}">
        <span class="menu-icon">
            <i class="ki-duotone ki-folder fs-1">
                <span class="path1"></span>
                <span class="path2"></span>
            </i>
        </span>
        <span data-i18n="title.files" class="menu-title">Files</span>
    </a>
</div>
{{- if .LoggedUser.CanManageShares}}
<div class="menu-item">
    <a class="menu-link {{- if eq .CurrentURL .SharesURL}} active{{- end}}" href="{{.SharesURL}}">
        <span class="menu-icon">
            <i class="ki-duotone ki-share fs-1">
                <span class="path1"></span>
                <span class="path2"></span>
                <span class="path3"></span>
                <span class="path4"></span>
                <span class="path5"></span>
                <span class="path6"></span>
            </i>
        </span>
        <span data-i18n="title.shares" class="menu-title">Shares</span>
    </a>
</div>
{{- end}}
{{- if .LoggedUser.CanManageMFA}}
<div class="menu-item">
    <a class="menu-link {{- if eq .CurrentURL .MFAURL}} active{{- end}}" href="{{.MFAURL}}">
        <span class="menu-icon">
            <i class="ki-duotone ki-shield fs-1">
                <span class="path1"></span>
                <span class="path2"></span>
            </i>
        </span>
        <span data-i18n="title.two_factor_auth_short" class="menu-title">2FA</span>
    </a>
</div>
{{- end}}
{{- end}}
